<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.*" %>
<%
   // 获取application 主次版本号
   String Version =String.valueOf(application.getMajorVersion()) +'.'+ String.valueOf(application.getMinorVersion());
   String ContextPath= application.getContextPath();
   String ServerInfo= application.getServerInfo();
   String ServletContextName= application.getServletContextName();
   String title = "再次访问菜鸟教程实例";
   Integer visitCount = new Integer(0);
   String visitCountKey = new String("visitCount");

	   visitCount = (Integer)application.getAttribute(visitCountKey);
	   if(visitCount==null) {application.setAttribute(visitCountKey,0); visitCount=0;}
	   visitCount += 1;
	
	   application.setAttribute(visitCountKey,  visitCount);
 
%>
<html>
<head>
<title>application 跟踪</title>
</head>
<body>

<h1>application 跟踪</h1>

<table border="1" align="center"> 
<tr bgcolor="#949494">
   <th>application 信息</th>
   <th>值</th>
</tr> 

<tr>
   <td>版本servlet version</td>
   <td><% out.print(Version); %></td>
</tr> 
<tr>
   <td>获取当前Web应用程序的根目录。</td>
   <td><% out.print(ContextPath); %></td>
</tr> 
<tr>
   <td>获取当前Web服务器的版本信息。</td>
   <td><% out.print(ServerInfo); %></td>
</tr> 
<tr>
   <td>获取当前Web应用程序的名称。</td>
   <td><% out.print(ServletContextName); %></td>
</tr> 

<%
 Enumeration headerNames =application.getAttributeNames() ;
 while(headerNames.hasMoreElements() ){
	
	 String paramName = (String)headerNames.nextElement();
     out.print("<tr><td> +" + paramName + "</td>\n");
     String paramValue = application.getAttribute(paramName).toString();
     out.println("<td> " + paramValue + "</td></tr>\n");
}
%>
</table> 
<%
application. log("application. log .xzxcv");
 %>
</body>
</html>